/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 刘国水
 * Date: 2025-04-13
 * Time: 20:00
 */
public class Test {
    public static void main(String[] args) {
        MyArrayList myArrayList = new MyArrayList();
        myArrayList.add(0,11);
        myArrayList.add(1,22);
        myArrayList.add(2,33);
        myArrayList.add(3,44);
        myArrayList.add(2,11);
        myArrayList.display();
        System.out.println("====================");
        int ret = myArrayList.get(1);
        System.out.println(ret);
        myArrayList.contains(0);

    }
    public static void main5(String[] args) {
        MyArrayList myArrayList = new MyArrayList();
        try {
            myArrayList.add(0,11);
            myArrayList.add(1,22);
            myArrayList.add(2,33);
            myArrayList.add(3,44);
            myArrayList.add(4,55);
            myArrayList.display();

            myArrayList.remove(5);
            myArrayList.display();
//            int ret = myArrayList.get(1);
//            System.out.println(ret);
        } catch (EmptyListException e) {
            e.printStackTrace();
        } catch (PosIllegaListyException e) {
            e.printStackTrace();
            System.out.println("add pos位置异常");
        }
    }
//    public static void main1(String[] args) {
//        MyArrayList myArrayList = new MyArrayList();
//        myArrayList.add(1);
//        myArrayList.add(2);
//        myArrayList.add(3);
//        myArrayList.add(4);
//        myArrayList.display();
//        System.out.println(myArrayList.size());
//        int ret = myArrayList.indexOf(7);
//        System.out.println(ret);
//        System.out.println("====================");
//        try {
//            int ret1 = myArrayList.get(5);
//            System.out.println(ret1);
//        } catch (EmptyListException e) {
//            e.printStackTrace();
//        } catch (PosIllegaListyException e) {
//            e.printStackTrace();
//        }
//        System.out.println("哈哈");
//   }
}
